<template>
  <view>
    <view class="special-work-list__item">
      <text class="special-work-list__label">设备管道名称：</text>
      <text class="special-work-list__value">{{ detail.equipmentPipeName }}</text>
    </view>
    <view class="special-work-list__item">
      <text class="special-work-list__label">介质：</text>
      <text class="special-work-list__value">{{ detail.medium }}</text>
    </view>
    <view class="special-work-list__item">
      <text class="special-work-list__label">温度(℃)：</text>
      <text class="special-work-list__value">{{ detail.temperature }}</text>
    </view>
    <view class="special-work-list__item">
      <text class="special-work-list__label">压力(Pa)：</text>
      <text class="special-work-list__value">{{ detail.pressure }}</text>
    </view>

    <view class="special-work-list__item flex-col">
      <text class="special-work-list__label">盲板位置图及编号</text>
      <image
        v-if="detail.image"
        :src="`${staticUrl}${detail.image}`"
        mode="aspectFill"
        class="special-work__img"
        @click="handlePreviewImage(`${staticUrl}${detail.image}`)"
      ></image>
    </view>
    <view class="special-work-list__item flex-col">
      <uni-table style="margin-bottom: 12rpx" stripe border>
        <uni-tr>
          <uni-td style="width: 220rpx">盲板材质</uni-td>
          <uni-td>{{ detail.material }}</uni-td>
        </uni-tr>
        <uni-tr>
          <uni-td>盲板规格</uni-td>
          <uni-td>{{ detail.specification }}</uni-td>
        </uni-tr>
        <uni-tr>
          <uni-td>盲板编号</uni-td>
          <uni-td>{{ detail.serialNumber }}</uni-td>
        </uni-tr>
      </uni-table>
      <view v-for="(item, index) in detail.workModality" :key="index" style="margin-bottom: 12rpx">
        <uni-table stripe border>
          <uni-tr>
            <uni-td style="width: 220rpx">作业类别</uni-td>
            <uni-td>{{ item.blandPlateTypeLabel }}</uni-td>
          </uni-tr>
          <uni-tr>
            <uni-td>作业实施时间</uni-td>
            <uni-td>
              {{ actualDateLabel }}
            </uni-td>
          </uni-tr>
          <uni-tr>
            <uni-td>抽堵关联</uni-td>
            <uni-td>{{ item.relateBlandPlateTicketCode }}</uni-td>
          </uni-tr>
        </uni-table>
      </view>
    </view>

    <view class="special-work-list__item">
      <text class="special-work-list__label">编制人：</text>
      <text class="special-work-list__value">{{ detail.creatorLabel }}</text>
    </view>
    <view class="special-work-list__item">
      <text class="special-work-list__label">编制日期：</text>
      <text class="special-work-list__value">{{ detail.createTime }}</text>
    </view>
  </view>
</template>

<script>
import { staticUrl } from '@/config.js'
export default {
  props: {
    detail: {
      type: Object,
      default: () => ({})
    },
    ticket: {
      type: Object,
      default: () => ({})
    },
    inspect: {
      type: Object,
      default: () => ({})
    },
    actualDateLabel: String
  },
  data() {
    return {
      staticUrl
    }
  },
  created() {
    console.log(this.inspect)
  },
  computed: {
    guardianshipNames() {
      if (!this.inspect[5]) {
        return {}
      }
      const result = {
        c: [], // 抽
        d: [] // 堵
      }
      this.inspect[5].forEach((item) => {
        if (item.ticketNodeName.indexOf('抽') > -1) {
          result.c.push(item.reviewerName)
        } else if (item.ticketNodeName.indexOf('堵') > -1) {
          result.d.push(item.reviewerName)
        }
      })
      return {
        c: result.c.join('，'), // 抽
        d: result.d.join('，') // 堵
      }
    },
    performNames() {
      if (!this.inspect[8]) {
        return {}
      }
      const result = {
        c: [], // 抽
        d: [] // 堵
      }
      this.inspect[8].forEach((item) => {
        if (item.ticketNodeName.indexOf('抽') > -1) {
          result.c.push(item.reviewerName)
        } else if (item.ticketNodeName.indexOf('堵') > -1) {
          result.d.push(item.reviewerName)
        }
      })
      return {
        c: result.c.join('，'), // 抽
        d: result.d.join('，') // 堵
      }
    }
  },
  methods: {
    handlePreviewImage(url) {
      uni.previewImage({
        urls: [url]
      })
    }
  }
}
</script>

<style scoped lang="scss">
@import '../style/style.scss';
</style>
